// This store is having a sale where if the price is an even number, you get 10
// Rustbucks off, but if it's an odd number, it's 3 Rustbucks off.
// Don't worry about the function bodies themselves, we are only interested in
// the signatures for now.


// main() 函数中的变量 original_price 是一个基本类型。进入函数时是栈中的值copy。没有所有权转移。
// 函数 sale_price() 对进入的值进行计算，然后返回结果。
// 返回的结果 price-10 生成的是一个新的值。
fn is_even(num: i64) -> bool {
    num % 2 == 0
}

// TODO: Fix the function signature.
fn sale_price(price: i64) -> (i64){
    if is_even(price) {
        price - 10  // 表达式
    } else {
        price - 3  // 表达式
    }
}

fn main() {
    let original_price = 51;
    println!("Your sale price is {}", sale_price(original_price));
    println!("Your old sale price is {}", original_price);
}
